﻿using System.Linq;
using Irony.Ast;
using Irony.Parsing;
using LibraryGuard.Interfaces;

namespace LibraryGuard.Internals.AST
{
	/// <summary>
	/// Reperesents parameter list in function call.
	/// </summary>
	internal class ParameterList
	{
		#region Fields
		public readonly IValue[] Parameters = null;
		#endregion

		#region Constructor
		public ParameterList(IValue[] args)
		{
			this.Parameters = args;
		}
		#endregion

		#region Statics
		public static void Create(AstContext context, ParseTreeNode parseNode)
		{
			parseNode.AstNode = new ParameterList(parseNode.ChildNodes.Select(n => n.AstNode).Cast<IValue>().ToArray());
		}
		#endregion
	}
}
